﻿using System;

namespace Program09
{
    class Program
    {
        static void Main(string[] args)
        {
            //使用递归数列求1-n的和
            Console.WriteLine("1-5的和为：{0}", GetSum(5));
            Console.WriteLine("1-66的和为：{0}", GetSum(68));
        }
        public static int GetSum(int n)
        {
            if (n == 1)

                return 1;
            //递归调用自己
            int temp = GetSum(n - 1);
            return temp + n;


        }
    }
}
